//***********************************************************************
//	File:		CryoNet.cpp
//	Author:		
//	Course:		SGP 1405
//	Purpose:	
//***********************************************************************
//***********************************************************************
//	Purposfully left blank for all comments regarding this file 
//	
//	
//	
//***********************************************************************



#include "CryoNet.h"
#include "../Message/DestroyEntityMessage.h"


CryoNet::CryoNet(float posX, float posY, Entity* owner)
{
	SetEffectRadius(200); 
	//SetImage();
	SetLifespan(5);
	SetLifespanTimer(0);
	//SetParticleEffect();
	SetPosition(SGD::Point{ posX, posY }); 
	SetRotation(owner->GetRotation());
	SetSize(SGD::Size{ 4, 4 });
	SetVelocity(SGD::Vector{ 0, -1 }); 
}

void CryoNet::Update(float dt)
{

	SGD::Event* pCryo = new SGD::Event("CRYO_NET", nullptr, this);
	pCryo->QueueEvent();

	SetLifespanTimer(GetLifeSpanTimer() + dt); 
	if (GetLifeSpanTimer() > GetLifeSpan())
	{
		DestroyEntityMessage* entityToDestroy = new DestroyEntityMessage(this); 
		entityToDestroy->QueueMessage(); 
	}

	//End of function
	Entity::Update(dt);
}

void CryoNet::Render(void)
{

}

void CryoNet::HandleCollision(const IEntity* pOther)
{

}

void CryoNet::HandleEvent()
{

}

SGD::Rectangle CryoNet::GetRect() const
{
	return SGD::Rectangle
	{
	GetPosition() - GetSize() / 2, 
	GetPosition() + GetSize() / 2
	};
}

